home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / g / gnu_c / crssrc16.zoo / src / touchwin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-27  |  1.8 KB  |  68 lines

  1. /*
  2.  * Copyright (c) 1981 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  */
  17.  
  18. #ifndef lint
  19. static char sccsid[] = "@(#)touchwin.c    5.3 (Berkeley) 6/30/88";
  20. #endif /* not lint */
  21.  
  22. # include    "curses.ext"
  23.  
  24. /*
  25.  * make it look like the whole window has been changed.
  26.  *
  27.  */
  28. void touchwin(win)
  29. register WINDOW    *win;
  30. {
  31.     register int    y, maxy;
  32.  
  33. # ifdef    DEBUG
  34.     fprintf(outf, "TOUCHWIN(%0.2o)\n", win);
  35. # endif
  36.     maxy = win->_maxy;
  37.     for (y = 0; y < maxy; y++)
  38.         touchline(win, y, 0, win->_maxx - 1);
  39. }
  40.  
  41. /*
  42.  * touch a given line
  43.  */
  44. void touchline(win, y, sx, ex)
  45. register WINDOW    *win;
  46. register int    y, sx, ex;
  47. {
  48. # ifdef DEBUG
  49.     fprintf(outf, "TOUCHLINE(%0.2o, %d, %d, %d)\n", win, y, sx, ex);
  50.     fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
  51. # endif
  52.     sx += win->_ch_off;
  53.     ex += win->_ch_off;
  54.     if (win->_firstch[y] == _NOCHANGE) {
  55.         win->_firstch[y] = sx;
  56.         win->_lastch[y] = ex;
  57.     }
  58.     else {
  59.         if (win->_firstch[y] > sx)
  60.             win->_firstch[y] = sx;
  61.         if (win->_lastch[y] < ex)
  62.             win->_lastch[y] = ex;
  63.     }
  64. # ifdef    DEBUG
  65.     fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
  66. # endif
  67. }
  68.